package io.gitee.zicai.bus.sample.adaptor;

import io.gitee.zicai.bus.bus.EventReceiveBus;
import io.gitee.zicai.bus.sample.cmd.CmdReceiveData;
import io.gitee.zicai.bus.sample.cmd.ICmdReceiver;

import java.util.function.BiConsumer;

/**
 * CmdReceiveBus
 *
 * @author zicai
 * @since 2021-04-02
 */
public class CmdReceiveBus extends EventReceiveBus<ICmdReceiver, CmdReceiveData> {

    public CmdReceiveBus(CmdReceiveData receiveData) {
        super(receiveData);
    }

    public static CmdReceiveBus of(CmdReceiveData receiveData) {
        return new CmdReceiveBus(receiveData);
    }

    @Override
    public BiConsumer<ICmdReceiver, CmdReceiveData> receive() {
        return receiveData.getCmdEnum().cmdReceiver;
    }
}
